<html>
<head><meta charset="utf-8"><title>extern cdecl behaving like extern C · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/extern.20cdecl.20behaving.20like.20extern.20C.html">extern cdecl behaving like extern C</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="233888080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/extern%20cdecl%20behaving%20like%20extern%20C/near/233888080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/extern.20cdecl.20behaving.20like.20extern.20C.html#233888080">(Apr 09 2021 at 20:49)</a>:</h4>
<p><a href="https://godbolt.org/z/W83zn1q9e">https://godbolt.org/z/W83zn1q9e</a><br>
<code>lea     rdi, [rsp + 16]</code><br>
this definitely is not cdecl calling convention <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="233889233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/extern%20cdecl%20behaving%20like%20extern%20C/near/233889233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/extern.20cdecl.20behaving.20like.20extern.20C.html#233889233">(Apr 09 2021 at 21:00)</a>:</h4>
<p>even when using <code>fastcall</code> the place of first argument does not change, even though it should be rcx</p>



<a name="233890409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/extern%20cdecl%20behaving%20like%20extern%20C/near/233890409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/extern.20cdecl.20behaving.20like.20extern.20C.html#233890409">(Apr 09 2021 at 21:04)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/125505306744a0a5bb01d62337260a95d9ff8d57/compiler/rustc_middle/src/ty/layout.rs#L2719">https://github.com/rust-lang/rust/blob/125505306744a0a5bb01d62337260a95d9ff8d57/compiler/rustc_middle/src/ty/layout.rs#L2719</a></p>



<a name="233890661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/extern%20cdecl%20behaving%20like%20extern%20C/near/233890661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/extern.20cdecl.20behaving.20like.20extern.20C.html#233890661">(Apr 09 2021 at 21:05)</a>:</h4>
<p>By the way aren't cdecl and fastcall their own thing only x86 and not x86_64?</p>



<a name="233892080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/extern%20cdecl%20behaving%20like%20extern%20C/near/233892080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/extern.20cdecl.20behaving.20like.20extern.20C.html#233892080">(Apr 09 2021 at 21:12)</a>:</h4>
<p>i mean, they are allowed on x86_64, unlike for example on riscv, so i expect them to behave kinda like on x86</p>



<a name="233892325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/extern%20cdecl%20behaving%20like%20extern%20C/near/233892325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/extern.20cdecl.20behaving.20like.20extern.20C.html#233892325">(Apr 09 2021 at 21:12)</a>:</h4>
<p>on other targets <code>extern "fastcall"</code> just doesn't compile</p>



<a name="233892422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/extern%20cdecl%20behaving%20like%20extern%20C/near/233892422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/extern.20cdecl.20behaving.20like.20extern.20C.html#233892422">(Apr 09 2021 at 21:13)</a>:</h4>
<p>That they are allowed in C would likely be for compatibility purposes.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>